<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>

    </style>
</head>

<body>
    <div id="app">
    </div>
</body>
<script>
    let arr = [10, 20, 30, 40]

    // map回调函数中的第三个参数是原数组
    let arr1 = arr.map((item, index, arr) => {
        console.log(item, index, arr)
        return item + ''
    })

    // filter中第三个参数也是原数组
    let arr2 = arr.filter((item, index, arr) => {
        console.log(item, index, arr)
        return item > 20
    })

    // 两个方法都不会改变原数组

    console.log(arr1, arr2)
</script>

</html>